const mongoose = require('mongoose');
const baseModel = require('./base.model')
const md5 = require('../util/md5')
const userSchema = new mongoose.Schema({
    username: {
        type: String,
        require: true
    },
    email: {
        type: String,
        require: true
    },
    password: {
        type: String,
        require: true,
        set: value => md5(value),
    },
    bio: {
        type: String,
        default: null
    },
    img: {
        type: String,
        default: null
    },
    ...baseModel
})

module.exports = userSchema;